package com.njmt.cloud.msprovder.controller;

import com.njmt.cloud.msprovder.config.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author <a href="mailto:xingxiao@gtmap.cn">xingxiaofeng</a>
 * @version2.1 2022-04-15
 * @description
 */
@RestController
public class UserController {

    @Autowired
    public  RedisUtil redisUtil;
    @GetMapping("/user/add")
    public String addUser() {
        try {
         for (int i=1;i<50;i++){
              redisUtil.set("user"+i, "123");
            }
        }catch (Exception e){
          return   e.getMessage();
        }
         return "成功";
    }
    @GetMapping("/user/getUser")
    public String getUser(@RequestParam("key")String key){
        String val= redisUtil.get(key).toString();
       return val;
    }

}
